package com.itheima.day04;

import java.util.Calendar;
import java.util.Date;

public class Demo5 {
    public static void main(String[] args) {
        Calendar calendar = Calendar.getInstance();
        calendar.set(2001,11,12);
        System.out.println("calendar = " + calendar);
        calendar.add(Calendar.YEAR,1);
        Date time = calendar.getTime();
        System.out.println("time = " + time);

        int year = calendar.get(Calendar.YEAR);
        int month = calendar.get(Calendar.MONTH)+1;
        int day = calendar.get(Calendar.DAY_OF_MONTH);
        System.out.println(year+"-"+month+"-"+day);
    }
}
